export class article {
  id?: number;
  name = '';
  cid = ''
  title = ''
  author = ''
  imageInput = "https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg"
  synopsis = ''
  shareTitle = ''
  shareSynopsis = ''
  visit = ''
  sort = ''
  url = ''
  mediaId = ''
  status = ''
  hide = ''
  adminId = ''
  merId = ''
  productId = ''
  isHot = false
  isBanner = true
  content = ''

  constructor(data?: article) {
    data && this.setProps(data);
  }

  setProps(data: article) {
    (Object.keys(this) as Array<keyof Iarticle>).forEach((key) => {
      // @ts-ignore
      this[key] = data[key]
    })
  }
}

export type Iarticle = Omit<article, 'setProps'>